﻿package net.wangit.framework.config;

import net.wangit.Path;
import net.wangit.util.FileUtil;

public class Domains {

	public static final String DEV = "dev";
	public static final String ADMIN = "adm";
	public static final String DEMO = "demo";
	public static final String LIB = "lib";
	public static final String TEST = "test";
	public static final String CMSC = "cc";
	public static final String APP = "app";
	private static boolean systemDomainsEnabled = false;
	private static String SYSTEM_DOMAINS = ",ab,adm,cc,cf,ci,crm,dev,dh,doc,etl,msg,pm,qu,setup,debug,";

	private Domains() {
	}

	public static boolean isSystemDomain(String domain) {
		if (systemDomainsEnabled)
			return false;
		return SYSTEM_DOMAINS.indexOf("," + domain + ",") >= 0;
	}

	static {
		try {
			String path = Path.getHomePath() + "/systemdomainsenabled.txt";
			systemDomainsEnabled = FileUtil.exists(path);
		} catch (Exception e) {
			systemDomainsEnabled = false;
		}
	}
}
